*****************************************************************
/* Replication Package for                                      *
  "Knowledge Accumulation and Gender Norms"                     */                  
                                                                *
                                                                *
*****************************************************************


clear all
set maxvar 10000


use  "C:\Users\natli\OneDrive\Desktop\SKEDRI LAP REVISION\3-FINAL FILES FOR ACCEPTANCE\REGS\FINAL DATA FOR REPLICATION.dta"



**********************************************************
// TABLE 2 OF THE MANUSCRIPT
**********************************************************


global y_vars  d062 d063   d066_b d064  a048
 


global x1list eci_plus  eci_plus_SQ  ln_ny_gdp_pcap_kd  ne_trd_gnfs_zs



local i = 1
foreach var of global y_vars {
eststo m`i': reg `var'  $x1list  i.CODEESSEVSWVS_num i.mean_var_wvs_years   age age_sq i.x025 i.x001 i.x047 [aw=s017] , r cluster (CODEESSEVSWVS )
outreg2 using "Table1.tex",   label dec(3) pdec(3) addtext(Individual Controls, YES, Country FE, YES, Round FE, Yes)  nonotes addnote(robust standard errors in parentheses; *p<.05; **p<.01; ***p<.001) keep( eci_plus  eci_plus_SQ  ln_ny_gdp_pcap_kd  ne_trd_gnfs_zs )      



//estimates store m`i'
local ++i
}



**********************************************************
// TABLE 3 OF THE MANUSCRIPT
**********************************************************


global y_vars  c001 d059 d078 e233


global x1list eci_plus  eci_plus_SQ  ln_ny_gdp_pcap_kd  ne_trd_gnfs_zs


local i = 1
foreach var of global y_vars {
eststo m`i': reg `var'  $x1list  i.CODEESSEVSWVS_num i.mean_var_wvs_years  age age_sq i.x025 i.x001 i.x047 [aw=s017] , r cluster (CODEESSEVSWVS )
outreg2 using "TablePI.tex",   label dec(3) pdec(3) addtext(Individual Controls, YES, Country FE, YES, Round FE, Yes)  nonotes addnote(robust standard errors in parentheses; *p<.05; **p<.01; ***p<.001) keep( eci_plus  eci_plus_SQ  ln_ny_gdp_pcap_kd  ne_trd_gnfs_zs )      


//estimates store m`i'
local ++i
}
 

 
 


**********************************************************
// TABLE 4 OF THE MANUSCRIPT
**********************************************************


global y_vars  c001 d059 d078 e233
 

global x1list eci_plus  eci_plus_SQ  ln_ny_gdp_pcap_kd  ne_trd_gnfs_zs


local i = 1
foreach var of global y_vars {
eststo m`i': reg `var'  $x1list  i.CODEESSEVSWVS_num i.mean_var_wvs_years  age age_sq i.x025 i.x001 i.x047 [aw=s017] if ny_gdp_pcap_kd>60000, r cluster (CODEESSEVSWVS )
outreg2 using "TablePI-RECENT.tex",   label dec(3) pdec(3) addtext(Individual Controls, YES, Country FE, YES, Round FE, Yes)  nonotes addnote(robust standard errors in parentheses; *p<.05; **p<.01; ***p<.001) keep( eci_plus  eci_plus_SQ  ln_ny_gdp_pcap_kd  ne_trd_gnfs_zs )      


//estimates store m`i'
local ++i
}
 
 
 

	 **********************************************************
	// TABLE 5 OF THE MANUSCRIPT 
	**********************************************************


	global y_vars d067 d068 d069 d070 d071       


	global x1list eci_plus  eci_plus_SQ  ln_ny_gdp_pcap_kd  ne_trd_gnfs_zs
	 
	local i = 1
	foreach var of global y_vars {
	eststo m`i': reg `var'  $x1list  i.CODEESSEVSWVS_num i.mean_var_wvs_years  age age_sq i.x025 i.x001 i.x047 [aw=s017] , r cluster (CODEESSEVSWVS )
	outreg2 using "TableCH.tex",   label dec(3) pdec(3) addtext(Individual Controls, YES, Country FE, YES, Round FE, Yes)  nonotes addnote(robust standard errors in parentheses; *p<.05; **p<.01; ***p<.001) keep( eci_plus  eci_plus_SQ  ln_ny_gdp_pcap_kd  ne_trd_gnfs_zs )      


	//estimates store m`i'
	local ++i
	}
	   

 
  

  

 


**********************************************************
// TABLE 1 OF THE MANUSCRIPT-SUMMARY STATISTICS
**********************************************************

/* As summary statistics change for each variable, we run regressions here only with the variable with the maximum number of obs so as to provide the summary statistics for the maximum sample. Using this code one produce sum stats for any chosen sample.
 
// d062 d063   d066_b d064  a048  // Respectively we use those variables to obtain summary statistics for each sample associated with them-replace tehm in line 54 at the place of the variable d066_b. As such we can produce summary statistics for the norms in respective samples

*/
global y_vars  d066_b // 

global x1list eci_plus  eci_plus_SQ  ln_ny_gdp_pcap_kd  ne_trd_gnfs_zs



local i = 1
foreach var of global y_vars {
eststo m`i': reg `var'  $x1list  i.CODEESSEVSWVS_num i.mean_var_wvs_years   age age_sq i.x025 i.x001 i.x047 [aw=s017] , r cluster (CODEESSEVSWVS )
outreg2 using "Table1.tex",   label dec(3) pdec(3) addtext(Individual Controls, YES, Country FE, YES, Round FE, Yes)  nonotes addnote(robust standard errors in parentheses; *p<.05; **p<.01; ***p<.001) keep( eci_plus  eci_plus_SQ  ln_ny_gdp_pcap_kd  ne_trd_gnfs_zs )      



//estimates store m`i'
local ++i
}




//SUMMARIZE FOR THE MAXIMUM SAMPLE I.E., d066_b

tab x001, gen(x001_dum) // 1 male 2 female
tab x025, gen (x025_dum)
tab x047, gen (x047_dum)
	   
// Note that if e(sample)==1 restricts the sample to the countries actually used in each regression. The actual e(sample) changes depending on the variable indicated in line 54.  
sum age x001_dum1 x001_dum2 x025_dum1-x025_dum8 d066_b x047_dum1-x047_dum11 eci_plus ln_ny_gdp_pcap_kd ne_trd_gnfs_zs if e(sample)==1


 

// In order to create the list of countries that are available for each sample (i.e., Table A3 of the manuscript)
tab ctry_name if e(sample)==1
// Note that if e(sample)==1 restricts the sample to the countries actually used in each regression. The actual e(sample) changes depending on the variable indicated in line 54.

/*
// COMMANDS TO MAKE TABLE A7 VALUES OF ECI-PLUS FOR THE MAX SAMPLE
keep if e(sample)==1
collapse eci_plus , by(ctry_name)
sort eci_plus
list ctry_name eci_plus

*/

 
